package top.withwings.bonus.bonus.pojo;

import org.thymeleaf.util.StringUtils;

public class Good {

    private int id;
    private String code;
    private String name;
    private String specification;
    private double standardPrice;//基准价格
    private boolean enabled;


    public Good(){

    }
    public Good(int id, String code, String name, String specification, double standardPrice) {
        this.id = id;
        this.code = code;
        this.name = name;
        this.specification = specification;
        this.standardPrice = standardPrice;
        this.enabled=true;
    }



    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSpecification() {
        return specification;
    }

    public void setSpecification(String specification) {
        this.specification = specification;
    }

    public double getStandardPrice() {
        return standardPrice;
    }

    public void setStandardPrice(double standardPrice) {
        this.standardPrice = standardPrice;
    }

    public String getFullName() {
        if(StringUtils.isEmpty(specification)){
            return name;
        }
        return name+ "("+specification+")";
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }

    @Override
    public String toString() {
        return "Good{" +
                "id=" + id +
                ", code='" + code + '\'' +
                ", name='" + name + '\'' +
                ", specification='" + specification + '\'' +
                ", standardPrice=" + standardPrice +
                ", enabled=" + enabled +
                '}';
    }
}